import request from '@/utils/request'

// 区域列表
export const regionSearch = (params) => {
  return request({
    url: '/api/vm-service/region/search',
    params
  })
}

// 新增区域
export const addRegion = (data) => {
  return request({
    url: '/api/vm-service/region',
    method: 'POST',
    data
  })
}

// 修改区域
export const updateRegion = (id, data) => {
  return request({
    url: `/api/vm-service/region/${id}`,
    method: 'PUT',
    data
  })
}

// 获取区域详情
export const getRegionDetails = (regionId) => {
  return request({
    url: `/api/vm-service/region/${regionId}`,
    method: 'GET'
  })
}

// 点位搜索
export const nodeSearch = (params) => {
  return request({
    url: '/api/vm-service/node/search',
    params
  })
}

// 新增点位
export const addNode = (data) => {
  return request({
    url: '/api/vm-service/node',
    method: 'POST',
    data
  })
}

// 获取修改点位信息
export const updateNodeDetail = (id) => {
  return request({
    url: `/api/vm-service/node/${id}`
  })
}

// 修改点位
export const updateNode = (id, data) => {
  return request({
    url: `/api/vm-service/node/${id}`,
    method: 'PUT',
    data
  })
}

// 点位详情
export const nodeDetail = (id) => {
  return request({
    url: `/api/vm-service/node/vmList/${id}`
  })
}
// 合作商搜索
export const partnerSearch = (params) => {
  return request({
    url: '/api/user-service/partner/search',
    params
  })
}

// 商圈列表
export const businessType = () => {
  return request({
    url: '/api/vm-service/businessType'
  })
}

// 新增合作商
export const addPartner = (data) => {
  return request({
    url: '/api/user-service/partner',
    method: 'POST',
    data
  })
}

// 重置合作商密码
export const resetPwd = (id) => {
  return request({
    url: `/api/user-service/partner/resetPwd/${id}`,
    method: 'PUT'
  })
}

// 合作商详情
export const partnerDetail = (id) => {
  return request({
    url: `/api/user-service/partner/${id}`
  })
}

// 修改合作商
export const updatePartner = (id, data) => {
  return request({
    url: `/api/user-service/partner/${id}`,
    method: 'PUT',
    data
  })
}
